<template>
  <div class="content">
    <div class="href">
      <div class="link">首页</div>
      <icon name="iconxiangyoubeifen16" size="14" />
      <div class="link">商品推荐</div>
    </div>
    <div class="banner">
      <div class="cont">
        <div class="info">
          <div class="tit">每日推荐</div>
          <div class="tips">每日12：00点更新</div>
        </div>
        <GoodsItem3 />
        <GoodsItem3 />
        <GoodsItem3 />
        <GoodsItem3 />
        <GoodsItem3 />
      </div>
    </div>
    <div class="list">
      <GoodsItem4
        v-for="(item, index) in goodsList"
        :key="index"
        :goods="item"
      />
    </div>
    <center class="page-box">
      <Pages1
        :total="false"
        :pages="false"
        :jump="false"
        v-model="query.current"
        :size="query.length"
        :count="query.total"
      />
    </center>
  </div>
</template>

<script>
import api from "@/api";
import GoodsItem4 from "@/components/GoodsItem/GoodsItem4.vue";
import GoodsItem3 from "@/components/GoodsItem/GoodsItem3.vue";
import Pages1 from "@/components/Pages/Pages1.vue";
export default {
  name: "BrandAction",
  components: { GoodsItem4, GoodsItem3, Pages1 },
  data() {
    return {
      query: {
        current: 1,
        length: 10,
        total: 0,
      },
      goodsList: [], // 商品列表
    };
  },
  created() {
    this.getGoodsList();
  },
  methods: {
    async getGoodsList() {
      let loading = this.loadingMsg();
      let result = await api.DAY_SPECIAL(this.query);
      loading.close();
      this.goodsList = result.data;
      this.query.current = result.current;
      this.query.length = result.length;
      this.query.total = result.total;
      this.$forceUpdate();
      window.scrollTo(0, 0);
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  .href {
    max-width: 1200px;
    font-size: 0;
    line-height: 22px;
    margin: 20px auto;
    i {
      padding: 0 10px;
      vertical-align: inherit;
    }
    .link {
      display: inline-block;
      font-size: 16px;
      font-weight: 400;
      color: #333333;
      line-height: 22px;
    }
  }
  .banner {
    height: 284px;
    padding: 1px;
    background: #fb2853;
    margin: 20px 0;
    .cont {
      max-width: 1200px;
      margin: 40px auto;
      width: 1200px;
      height: 204px;
      background: #fce6aa;
      border-radius: 5px;
      display: flex;
      align-items: center;
      .info {
        padding: 0 40px 0 20px;
        .tit {
          font-size: 18px;
          font-weight: 400;
          color: #d52c1a;
          line-height: 25px;
          margin-bottom: 12px;
        }
        .tips {
          font-size: 14px;
          font-weight: 400;
          color: #d52c1a;
          line-height: 20px;
        }
      }
    }
  }
  .spike-tit {
    max-width: 1200px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    .starting {
      width: 332px;
      height: 44px;
      background: #d52c1a;
      border-radius: 22px;
      display: flex;
      font-size: 18px;
      font-weight: 600;
      color: #fce6aa;
      line-height: 25px;
      align-items: center;
      justify-content: center;
      .tit {
        padding-right: 40px;
      }
    }
    .future {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 64px;
      .time {
        font-size: 18px;
        font-weight: 600;
        color: #d48d09;
        line-height: 25px;
        margin-right: 12px;
      }
      .btn {
        height: 44px;
        border-radius: 22px;
        border: 1px solid #d48d09;
        padding: 0 16px;
        line-height: 44px;
        font-size: 18px;
        font-weight: 400;
        color: #d48d09;
      }
      &.one {
        margin-left: 57px;
        .time {
          color: #d52c1a;
        }
        .btn {
          border-color: #d52c1a;
          color: #d52c1a;
        }
      }
    }
  }
  .list {
    max-width: 1200px;
    margin: 20px auto;
    font-size: 0;
    & div:nth-child(5n + 1) {
      margin-left: 0;
    }
  }
  .page-box {
    margin-bottom: 20px;
  }
}
</style>
